#include <iostream>

using namespace std;

template<typename T>
class NonCopyable { 
protected:
    /** 
     * Disalow construction of NonCopyable objects from outside of its hierarchy.
     */
    NonCopyable() { }
    /** 
     * Disalow destruction of NonCopyable objects from outside of its hierarchy.
     */
    ~NonCopyable() { }

private: 
    /**
     * Declare copy constructor as private, any attempt to copy construct 
     * a NonCopyable will fail at compile time.
     */
    NonCopyable(const NonCopyable&);

    /**
     * Declare copy assignement operator as private, any attempt to copy assign 
     * a NonCopyable will fail at compile time.
     */
    NonCopyable& operator=(const NonCopyable&);
};

class Resource
{
public:
	Resource(){};
	~Resource(){};
};

 class Foo : private NonCopyable<Foo> { 
 public:     
   Foo() : _resource(new Resource()) { }
   ~Foo() { delete _resource; } 
 private:
   Resource* _resource;
 };

int main(int argc, char const *argv[])
{
	Foo foo  = Foo();
	cout<<"hello"<<endl;
	return 0;
}